package cn.zymall.app.controller.menu;

import cn.zymall.app.service.MenuService;
import cn.zymall.common.model.IndexMenu;
import cn.zymall.common.utils.response.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xuxianda
 * @Description: 菜单控制器
 * @date 2020/8/26 11:44
 * @Copyright
 * @return
 **/
@RestController
@RequestMapping("menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    /**
     * 保存单条菜单
     *
     * @param indexMenu
     * @return
     */
    @PostMapping
    public HttpResult save(@RequestBody IndexMenu indexMenu) {
        return menuService.save(indexMenu);
    }

    @DeleteMapping
    public HttpResult remove(@RequestBody IndexMenu indexMenu) {
        return menuService.remove(indexMenu);
    }

    @GetMapping
    public HttpResult query() {
        return menuService.query();
    }
}
